package org.dbwebx.flex.control.menu
{

	public class MenuItem extends MenuItemDescription
	{

		public static function createItemFromDescription(description:MenuItemDescription=null, enabled:Boolean=false):MenuItem
		{
			if (description == null)
			{
				throw new Error("MenuItemDescription can't be null");
			}
			var item:MenuItem=new MenuItem(description.action, "", description.icon, description.securityAction);
			item.enabled=enabled;
			return item;
		}

		public function MenuItem(chevronAction:String, labelString:String, icon:Class=null, securityAction:int=-1)
		{
			super(chevronAction, icon, securityAction);
			label=labelString;
		}

		/**
		 * Flag to enable/disable menu item.
		 * @default true
		 */
		private var _enabled:Boolean = true;

		/**
		 * The menu item label.
		 * @default 
		 */
		private var _label:String;

		public function get enabled():Boolean
		{
			return _enabled;
		}

		public function set enabled(value:Boolean):void
		{
			_enabled=value;
		}

		public function get label():String
		{
			return _label;
		}

		public function set label(value:String):void
		{
			_label=value;
		}

	}
}